package main

import (
	"math/rand"
	"fmt"
	"time"
)

func main() {
	var sli = make([]int, 0, 10)
	var count = make(map[int]int)
	rand.Seed(time.Now().Unix())
	for i := 0; i < 100; i++ {
		sli = append(sli, rand.Intn(128))
	}
	for _,val := range sli{
		if count[val] == 0 {
			count[val] = 1
		}else {
			count[val]++
		}
	}
	arr :=[]int{}
	for ind:=range count{
		if count[ind] > 1 {
			fmt.Printf("元素:%d 重复了%d次\n",ind,count[ind])
			arr = append(arr,ind)
		}
	}

	fmt.Printf("%d个重复元素",len(arr))
}